package com.eee.xiang.market.service.impl;

import com.eee.xiang.market.beans.OperateResponse;
import com.eee.xiang.market.beans.TUser;
import com.eee.xiang.market.dao.mapper.TUserMapper;
import com.eee.xiang.market.service.IEmployeeService;
import com.eee.xiang.market.utils.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class EmployeeServiceImpl implements IEmployeeService {

    @Autowired
    private TUserMapper userMapper;
    @Override
    public OperateResponse saveUser(TUser user) {
        user.setUserId(UUIDUtil.generate());
        user.setCreateDatetime(new Date());
        int i = userMapper.insertSelective(user);
        if(i > 0){
            return OperateResponse.obtainSuccessResponse(true);
        }else{
            return OperateResponse.failResponse("新增用户失败");
        }
    }
}
